#include <iostream>
#include <thread>
#include <mutex>

using std::cout;
using std::endl;
using std::thread;
using std::mutex;

void release(mutex *mtx)
{
    mtx->unlock();
    cout << "解锁。。。" << endl;
}

void test(int i)
{
    cout << i << endl;
}

int main(int args, char *argv[])
{
    mutex *mtx = new mutex();

    thread th(release, mtx);
    int i = 10;
    thread th1(test, i);

    mtx->lock();

    mtx->lock();
    cout << "解锁成功" << endl;

    th.join();
    th1.join();
    return 0;
}